package com.wanchuang.hepos.ui.page.adapter;

import com.chad.library.adapter.base.BaseMultiItemQuickAdapter;
import com.chad.library.adapter.base.module.LoadMoreModule;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.wanchuang.architecture.utils.DateUtil;
import com.wanchuang.hepos.R;
import com.wanchuang.hepos.bridge.data.bean.ZhanDanBean;
import com.wanchuang.hepos.help.GlideHelper;

import java.util.List;

/**
 * 文件名 : ZhanDanAdapter
 * 创建者 : MangoWang
 * 创建日期 : 2019/12/26 15:44
 * 微信 : MangoWaWang
 * 邮箱 : 763482205@qq.com
 * 描述 : TODO
 */
public class ZhanDanAdapter extends BaseMultiItemQuickAdapter<ZhanDanBean, BaseViewHolder> implements LoadMoreModule {

    public ZhanDanAdapter(List<ZhanDanBean> data) {
        super(data);
        addItemType(1, R.layout.item_zhan_dan_title);
        addItemType(2, R.layout.item_zhan_dan_content);
    }

    @Override
    protected void convert(BaseViewHolder helper, ZhanDanBean item) {
        switch (helper.getItemViewType()) {
            case 1:
                helper.setText(R.id.tv_zhang_dan_time, item.getTime());
                break;
            case 2:
                helper.setText(R.id.tv_money, item.getAmount())
                        .setText(R.id.tv_status, item.getStatus())
                        .setText(R.id.tv_time, DateUtil.getStrTime(item.getTime()))
                        .setText(R.id.tv_type, item.getType());
                GlideHelper.INSTANCE.loadImage(helper.getView(R.id.iv_image), item.getLogo());
                break;
        }
    }
}
